from wxPython.wx import *

class Clothing(wxWindow):
    def __init__(self, bitmap, parent, id, pos = wxDefaultPosition, size = wxDefaultSize, style = 0, name = ''):
        wxWindow.__init__(self, parent, id, pos, size, style, name)
        if not bitmap.Ok():
            raise 'Not a valid bitmap'
        self.bitmap = bitmap
        self.SetSize(wxSize(self.bitmap.GetWidth(), self.bitmap.GetHeight()))
        EVT_PAINT(self, self.OnPaint)
        EVT_MOUSEWHEEL(self, self.OnMouseWheel)

    def OnPaint(self, event):
        winDC = wxPaintDC(self)
        (x, y) = self.GetPositionTuple()
        winDC.DrawBitmap(self.bitmap, x, y, 1)

    def SetBitmap(self, bitmap):
        if not bitmap.Ok():
            raise 'not a valid bitmap'
        self.bitmap = wxBitmap
        self.SetSize(wxSize(self.bitmap.GetWidth(), self.bitmap.GetHeight()))

    def GetBitmap(self, bitmap):
        return self.bitmap
    
    def OnMouseWheel(self, event):
        print event.GetWheelRotation()
